﻿using PureMVC.Interfaces;
using PureMVC.Patterns.Command;

namespace CounterApp.PureMVC
{
    public class IncreaseCommand : SimpleCommand
    {
        public const string KEY = "INCREASE_COMMAND";
        
        public override void Execute(INotification notification)
        {
            // 获取 Proxy
            var proxy = Facade.RetrieveProxy(CounterAppModelProxy.NAME) as CounterAppModelProxy;

            proxy.IncreaseCount();

            // 发送更新事件到 View 层
            Facade.SendNotification("UPDATE_VIEW",proxy.Count);
        }
    }
}